package org.yinweichen.llm_dataset_backend.DTO;

import org.yinweichen.llm_dataset_backend.entity.EvalTask;

import java.util.Date;
import java.util.List;

public record GetTasksResponse(
    Long id,
    String version,
    String status,
    Date time,
    String title,
    String description,
    String prompt,
    List<String> judges,
    List<String> models,
    List<Long> questionIds
) {
    public static GetTasksResponse fromEvalTask(EvalTask task) {
        try {
            return new GetTasksResponse(
                task.getId(),
                task.getVersion(),
                task.getStatus(),
                task.getTime(),
                task.getTitle(),
                task.getDescription(),
                task.getPrompt(),
                task.getJudges(),
                task.getModels(),
                task.getQuestions()
            );
        } catch (Exception e) {
            throw new RuntimeException("Failed to parse task config", e);
        }
    }
}